<template>
    <span>
        <template v-if="action == 'edit'">
            <el-switch
                    @click.native="quickChange"
                    v-on="$listeners"
                    v-model="myValue">
            </el-switch>
        </template>
        <template v-if="action == 'table'">
            <el-switch
                    @change="quickChange"
                    :value="myValue">
            </el-switch>
        </template>
        <template v-if="action == 'search'">
              <el-select style="width:100%" v-model="myValue" placeholder="请选择">
                <el-option

                        v-on="$listeners"
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                </el-option>
            </el-select>
        </template>
    </span>
</template>
<script>
    import base from './base.js';

    export default {
        extends: base,
        props: {},
        data() {
            return {
                options: [{
                    value: '',
                    label: '全部'
                }, {
                    value: '1',
                    label: '是'
                }, {
                    value: '0',
                    label: '否'
                }],
                searchModel: 'range',
            }
        },
        created() {
            if(this.action !='search'){
                this.myValue = Boolean(this.value);
            }
        },
        watch: {
            value: function (newQuery) {
                if(this.action !='search'){
                    this.myValue = Boolean(newQuery);
                }
            },
        },
    }
</script>
<style>
</style>
